package com.five.wisdomEat.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.five.wisdomEat.entity.Announcement;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AnnouncementMapper extends BaseMapper<Announcement> {
    //查看所有公告
    @Select("SELECT * FROM announcement")
    List<Announcement> selectAnnouncementList();

    //添加公告
    @Insert("INSERT INTO announcement (id,a_content,a_time) VALUES (null,#{aContent},#{aTime})")
    Integer insertAnnouncement(Announcement announcement);

    //根据id修改公告
    @Update("UPDATE announcement SET a_content=#{aContent},a_time=#{aTime} WHERE id = #{id}")
    Integer updateAnnouncement(Announcement announcement);

    //根据id删除公告
    @Delete("DELETE FROM announcement WHERE id = #{id}")
    Integer deleteAnnouncement(Integer id);



}
